﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using V5_BLL;
using V5_Common;
using V5_Model;

namespace V5_EShop._Template.Default.Member
{
    public partial class Evaluate_Comment : BasicPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.check_member_login())
            {
                Response.Redirect("/login.aspx?returnurl=" + HTTPS.GetCurrentUrl());
            }
            if (!this.IsPostBack)
            {
                this.Bind_rpList1();
                this.Bind_rpList2();
            }
        }

        private void Bind_rpList1()
        {
            string strWhere = "";
            int Count = 0;
            strWhere = " MemberID=" + user.ID + " and Passed=0 ";
            Pager1.UrlRewritePattern = "/member/Evaluate_Comment.aspx?page={0}";
            this.rpList1.DataSource = new BLLProductComment().GetList(Pager1.PageSize,
                Pager1.CurrentPageIndex,
                strWhere,
                ref Count).Tables[0];
            this.Pager1.RecordCount = Count;
            this.rpList1.DataBind();
        }

        private void Bind_rpList2()
        {
            string strWhere = "";
            int Count = 0;
            strWhere = " MemberID=" + user.ID + " and Passed=1 ";
            Pager2.UrlRewritePattern = "/member/Evaluate_Comment.aspx?page={0}";
            this.rpList2.DataSource = new BLLProductComment().GetList(Pager2.PageSize,
                Pager2.CurrentPageIndex,
                strWhere,
                ref Count).Tables[0];

            this.Pager2.RecordCount = Count;
            this.rpList2.DataBind();
        }

        protected void Pager1_PageChanged(object sender, EventArgs e)
        {
            this.Bind_rpList1();
        }

        protected void Pager2_PageChanged(object sender, EventArgs e)
        {
            this.Bind_rpList2();
        }
    }
}
